const mongoose = require('mongoose')
const schema = new mongoose.Schema({
  name: {type: String},
  avatar: {type: String},
  banner:{type:String},
  title: {type: String},
  categories: [{type: mongoose.SchemaTypes.ObjectId,ref:'Category'}],//关联类型
  //categories:[],
  scores:{
    difficult:{type:Number},
    skill:{type:Number},
    attack:{type:Number},
    live:{type:Number},
  },
  skills:[{
    icon:{type:String},
    name:{type:String},
    delay:{type:String},
    cost:{type:String},
    desc:{type:String},
    tip:{type:String},
  }],
  items1:[{type: mongoose.SchemaTypes.ObjectId,ref:'Item'}],
  items2:[{type: mongoose.SchemaTypes.ObjectId,ref:'Item'}],
  useTip:{type:String},
  battleTip:{type:String},
  teamTip:{type:String},
  partners:[{
    hero:{type: mongoose.SchemaTypes.ObjectId,ref:'Hero'},
    desc:{type:String}
  }],
  skins:[{
    name:{type:String},
    url:{type:String}
  }],
  videos:[{
    title:{type:String},
    img:{type:String},
    playNum:{type:String}
  }]
},{
  timestamps:true
})

module.exports = mongoose.model('Hero', schema,'heroes')